<template>
  <div class="info-popups">
    <webview ref="webview"
             :src="videoUrl" style="width: 100%; height:100%;"></webview>
  </div>
</template>

<script>
console.log('info')
export default {
  name: "info-popups",
  props: {

  },
  data() {
    return {
      url:'https://www.bilibili.com/',
    }
  },
  computed:{
    videoUrl:{
     get(){
       return this.url
     },
      set(newValue){
       this.url = newValue
      }
    }
  },
  methods: {
    goback(type) {
      if (this.urlList.list.length === 0) {
        return
      }
      const webview = this.$refs.webview
      if (type === 1) {
        this.urlList.index--
      } else {
        this.urlList.index++
      }
      webview.src = this.urlList.list[this.urlList.index]
    }
  },
  mounted() {
    const webview = this.$refs.webview

    webview.getElementsByClassName('')
    webview.addEventListener('did-attach-webview', (e) => {
      console.log(e)
    })
    webview.addEventListener("new-window", (e) => {
      e.preventDefault()
      console.log(e)
      // return
      // webview.src = e.url
    })
    this.videoUrl = this.$route.query.url
    // setTimeout(()=>{
    //   webview.executeJavaScript(`
    // setTimeout(()=>{
    //        alert(111)
    //     }, 2000);
    // `)
    // },2000)
  }
}
</script>

<style scoped>
.info-popups {
  width: 100%;
  height: 100%;
}
</style>